refactor(runners): rewrite pre-2018 ref-patterns to match ergonomics - #90
Merged
Conversation
Part of #85 (Phase 2 of #1). Converts every &Some(ref x)/match &value { &Variant(ref x) => ... }/&mut Value::Object(ref mut x) site in api_caller, filtered_runner, and python_runner to plain match-ergonomics form -- purely syntactic, binds the identical (mutable or immutable) reference type as before. api_caller had two duplicated pagination-matching functions (find_results and the page-size calculator) each repeating the same 4-arm match, plus duplicated Number-coercion matches in two request-limit resolvers -- fixed all instances in each. filtered_runner and python_runner each had one &mut/ref mut site not caught by these clippy lints (which don't cover &mut patterns) but flagged by the same #85 inventory as the same anti-pattern. All three crates now have zero clippy::ref_patterns/match_ref_pats/ needless_borrowed_reference warnings. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018VzKriyNnMHmqQ6UxPhsv2
jhamill34
force-pushed
the
claude/issue-1-phase2-runners
branch
from
August 26, 2026 23:50
63b7593 to
846bbde
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #85 (Phase 2 of #1). Stacked on #89 (
usecases/*), which is stacked on #88 (Phase 1's lint policy).Same transform as #89, applied to
runners/*:if let &Some(ref x) = &y { ... }→if let Some(x) = &y { ... }match &value { &Variant(ref x) => ..., ... }→match value { Variant(x) => ..., ... }if let &mut Value::Object(ref mut x) = &mut y { ... }→if let Value::Object(x) = &mut y { ... }(same rule for mutable references —filtered_runnerandpython_runnereach had one of these; noteclippy::ref_patterns/needless_borrowed_referencedon't actually flag&mut/ref mutshapes, so these two were found by re-checking against the original site inventory rather than clippy's own output — worth keeping in mind for Phase 2 of #1: rewrite ~86 pre-2018 ref-pattern sites to match ergonomics #85's remainingbinary/*PR)Crates touched:
api_caller(23 sites — 2 more than originally scoped: two near-duplicate functions each repeat the same 4-arm pagination match, and two request-limit resolvers repeat the same Number-coercion match, all now fixed).filtered_runner(2 sites, one&mutshape).python_runner(1 site,&mutshape inbindings.rs).All three crates now have zero
ref_patterns/match_ref_pats/needless_borrowed_referencewarnings.Test plan
cargo build -p api_caller -p filtered_runner -p python_runner --all-features— clean.cargo clippy -p api_caller -p filtered_runner -p python_runner --all-features— zero warnings from the three targeted lints.cargo test -p api_caller -p filtered_runner -p python_runner --all-features— 7 tests, 0 failures.cargo build --workspace --all-features/cargo test --workspace --all-features— clean, zero failures.cargo fmt --all -- --check— clean.Generated by Claude Code